package com.example.administrator.nurse.util;

import android.app.Activity;
import android.graphics.Typeface;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by Administrator on 2016/4/22.
 * 字体设置
 */
public class FontHelper {
    public static void changeFonts(ViewGroup root,Activity activity){
        Log.d("xxxxx","changeFonts");
        Typeface typeface=Typeface.createFromAsset(activity.getAssets(),"titilliumWeb.ttf");
        int count=root.getChildCount();
        for(int i=0;i<count;i++){
            View view=root.getChildAt(i);
            if(view instanceof TextView){
                ((TextView)view).setTypeface(typeface);
            }else if (view instanceof ViewGroup){
                changeFonts((ViewGroup)view,activity);
            }
        }
    }
}
